Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Views.Base
Imports DevExpress.XtraGrid.Registrator
Imports DevExpress.XtraGrid.Views.Grid

Public Class IGridControl
    Inherits GridControl
    Public Overridable Property ShowGroupSummaryEditorItem As Boolean = True
    'Friend WithEvents GridView1 As DevExpress.XtraGrid.Views.Grid.GridView
    Friend WithEvents GridView1 As IGridView
    Protected Overrides Function CreateDefaultView() As BaseView
        Return CreateView("MyGridView")
    End Function

    Protected Overrides Sub RegisterAvailableViewsCore(ByVal collection As InfoCollection)
        MyBase.RegisterAvailableViewsCore(collection)
        collection.Add(New MyGridViewInfoRegistrator)
    End Sub

    Private Sub InitializeComponent()
        'Me.GridView1 = New DevExpress.XtraGrid.Views.Grid.GridView
        'CType(Me.GridView1, System.ComponentModel.ISupportInitialize).BeginInit()
        'CType(Me, System.ComponentModel.ISupportInitialize).BeginInit()
        'Me.SuspendLayout()
        ''
        'GridView1
        Me.GridView1.GridControl = Me
        Me.GridView1.Name = "GridView1"

        'MyGridControl()
        ''
        ''
        ''
        ''
        'Me.EmbeddedNavigator.Appearance.BackColor = System.Drawing.Color.DarkRed
        'Me.EmbeddedNavigator.Appearance.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        'Me.EmbeddedNavigator.Appearance.Options.UseBackColor = True
        'Me.EmbeddedNavigator.Appearance.Options.UseFont = True
        'Me.EmbeddedNavigator.Name = ""
        Me.MainView = Me.GridView1
        Me.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridView1})
        CType(Me.GridView1, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

    Private Sub IGridControl_ProcessGridKey(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.ProcessGridKey
        Dim grid As DevExpress.XtraGrid.GridControl = TryCast(sender, DevExpress.XtraGrid.GridControl)
        Dim gridView As IGridView = TryCast(grid.FocusedView, IGridView)
        If Not gridView.IsEditing AndAlso e.KeyCode = Keys.Enter Then
            SendKeys.SendWait("{TAB}")
            e.Handled = True
        End If
    End Sub


End Class
